JagUSB Theory of Operation:

The JagUSB hardware design is very flexible but most of its capabilities are
not yet realized.  Right now, it is using incomplete firmware, intended only
for my own hardware testing and further firmware development.

Like most designs, the JagUSB is layered:

    4 Software
    3 Firmware
    2 Digital
    1 Electrical

The electrical layer takes care of power regulation, system clocks and
reset, 3.3v/5v signal conversion, electrostatic discharge protection, and
USB soft fuses.  This layer functions automatically so I won't detail it
here.  However, you may notice that some USB devices do not power up -- this
is (sometimes) due to the soft fuses on the JagUSB protecting the anemic
Jaguar power supply.  Use a powered hub if this becomes a problem.

The digital layer contains the three major logic chips and their interconnections (from left-to-right):
    U3    AT49BV320D-70TU        Atmel 4MB, 16-bit, Flash ROM
        Connects to the Jaguar address bus and the PRIVATE data bus
        Contains boot program for Jaguar, EZ-HOST in 8KB boot block, game image in high 4088KB

    U2    XC9572XL-10VQG64C    Xilinx Complex Programmable Logic Device
        Responsible for address decoding, security, EEPROM/CD-ROM emulation, 'glue'
        Bridges the Jaguar data bus to the PRIVATE data bus
        Connects to the Jaguar serial busses:  EEPROM (save game), UART (ComLynx), and I2S (CD-ROM)

    U1    CY7C67300-100AXI    Cypress EZ-HOST USB CPU
        Runs USB drivers, FAT file system, debug/ComLynx code
        Connects to the PRIVATE data bus
        Controls the three USB ports (two host, one device)
        Controls Jaguar interrupt (EINT0) and Jaguar RESET line, to streamline debugging
        Connects to the PLD JTAG bus (U2), and is thus able to upgrade the CPLD with new firmware
        Monitors power regulator (U4) for overcurrent conditions

    The private data bus allows the PLD (U2) to prevent the Jaguar from accessing the EZ-HOST or Flash ROM
        This could be used for security features, but right now the busses are simply bridged

The firmware layer consists of three parts:
    VHDL (stored in U2) contains simple logic for address decoding, security, and serial shift registers
        At this time, only address decoding is functional
    EZ code (stored in U3, executed by U1) contains USB drivers and CD/EEPROM emulation code
        At this time, only simple BJL-style USB download/debug code is working
    Jag code (stored in U3) initialized the Jaguar and searches for boot code via USB
        At this time, the Jag can only be booted via PC (device port) not USB stick (host ports)

The software layer was intended to boot off of USB stick and present a menu
of available games, demos, and so on.  None of this is started, although I
was getting pretty far along on a Eclipse/C environment in which the
software was to be written.  C code could be uploaded and debugged visually,
but no serious C programs were written.

These are ideas I had while designing the hardware that 'should' work (with
enough software):
    Loading BJL code and Alpine ROMs from a PC (this works)
    Debugging running code via PC (also working)
    Loading BJL code and Alpine ROMs from a USB stick (not finished)
    Emulating EEPROM save game chip (requires synchronous VHDL -- not working)
    Loading/storing EEPROM save games on USB stick (requires EZ code -- not started)
    Fixing the UART bug by using USB cables (requires VHDL+EZ code -- not started)
    Emulating CD-ROM games (requires EZ code and new 68K CD-BIOS -- not started)
    Emulating CD Audio (requires VHDL -- not started)
    Allowing USB controllers to work with Jaguar games (requires EZ code -- not started)
        This patches the joystick handler in the ROM image as it is loaded to a JagUSB address
        I messed with this a little and all games I own are easily patched 
    Emulating 'special' controllers, such as Tempest/rotary, Iron Soldier/analog (EZ code -- not started)
    Emulating Jaguar Voice Modem via USB Ethernet Dongle (requires EZ code -- not started)
    Allowing USB sound cards to play digital/optical Jaguar sound (requires VHDL+EZ code -- not started)
    Booting Linux, allowing the Jaguar to work as a computer (not finished)
        This was surprisingly feasible based on the Atari ST 68K ucLinux port and EZ-HOST USB stack
        ucLinux can run from Flash ROM, allowing 4MB of binaries/OS with 2MB of DRAM still free
        USB hard disks, keyboards, mice, network adaptors and so on would all work 'for free'
    Allowing Bluetooth wireless controllers/wireless ComLynx to work via USB dongle (requires Linux)
    Securing ROM images with private key encryption (requires VHDL+EZ code to do right)
        This would allow developers to publish signed games for JagUSB knowing they could not be copied
        I spent quite a bit of time designing this before finalizing the hardware
        Mechanisms exist to store the keys where a hacked/BJL Jaguar cannot read them back
    Locking USB Flash Drives to prevent duplication (requires parts of the above step)
        This would allow developers to distribute USB Flash Drives that could not be duplicated
        The USB Flash Drive standard requires unique keys per device for copy protection


